const Controller = require('egg').Controller;

class GroupController extends Controller {
	async getGroup() {
		const {
			ctx
		} = this
		const data = await ctx.service.group.getGroup()
		ctx.body = {
			code: 1,
			data
		}
	}
	async delGroup() {
		const {
			ctx
		} = this
		const data = await ctx.service.group.delGroup()
		if (data.affectedRows >= 1) {
			ctx.body = {
				code: 1,
				message: '删除成功'
			}
		} else {
			ctx.body = {
				code: 0,
				message: '删除失败'
			}
		}
	}
}

module.exports = GroupController;